Skip to main content

Configuration

Most Important Values

Most job configuration files are similar. Here, you can learn about the most important ones:

Player Payouts

There are two types of payouts:

  • Base payout and bonus percentage for each additional player.
  • Fixed payouts for a given number of people.
config.lua
payout = {
-- Bonus system (there's a base payout and for each additional player, a bonus percentage)
useBonusPercent = false, -- Uses basePayout and bonusPercent per player
basePayout = 500,
-- 0.25 = 25%
bonusPercent = 0.25,
-- Total payout for each number of players
playerPayouts = {
[1] = 300,
[2] = 600,
[3] = 900,
[4] = 1200,
[5] = 1500,
[6] = 1800
},
},

Players activity check

Here, you can change when a player will be kicked out of the job by adjusting the following values:

  • closeCheck (boolean) - Enables/disables distance check from the vehicle. If a player is farther than vehDist, they get kicked.
  • noActionCheck (boolean) - Enables/disables an action check. If the difference in activity between the most active player and the checked player is higher or equal to noActionTimes, the checked player gets kicked.
  • offlineTime (integer [seconds]) - All of our jobs retain the player in the job in case of disconnection to prevent loss of progress. This value sets the time after which if a player doesn't reconnect, they will be automatically removed.

Difficulty

You can set the difficulty for each number of players. The values differ between jobs. For more information, please refer to the configuration of the desired job. Here's an example configuration for the plumber job:

config.lua
-- Adjusts the difficulty (size of the path) based on the number of players in the job
difficulty = {
[1] = "small",
[2] = "small",
[3] = "medium",
[4] = "medium",
[5] = "big",
[6] = "big",
},

## Implementing Car Keys for Jobs

To implement car keys for all jobs, you need to edit the `SpawnVehicle` function in the `sf-jobsystem` as shown below:

```lua title="server/main.lua:280"
function SpawnVehicle(owner, jobId, jobName, modelHash, coords)
local entity = CreateVehicle(modelHash, coords.x, coords.y, coords.z, coords.w, true, false)
local tries = 0
while not DoesEntityExist(entity) do
Citizen.Wait(0)
tries = tries + 1
if tries > 50 then return end
end
-- You can change vehicle plate here
if(jobName:len() > 7) then
jobName = jobName:sub(0, 7)
end
local plate = string.upper(jobName)..jobId
if(plate:len() > 8) then
plate = jobName:sub(0, 0 - (tostring(jobId)):len())..jobId
elseif(plate:len() < 8) then
local left = (8-plate:len())
plate = plate..jobName:sub(0, left)
end

SetVehicleNumberPlateText(entity, plate)
while not string.find(GetVehicleNumberPlateText(entity), plate) do
Citizen.Wait(0)
end
-- You can add your keys code below (owner = source of the player, GetVehicleNumberPlateText(entity) = vehicle plate)
-- For example like this:
exports.ox_inventory:AddItem(tonumber(owner), "carkey", 1, GetVehicleNumberPlateText(entity))
if(qbKeys) then
TriggerClientEvent("sf-jobsystem:qbKeys", owner, GetVehicleNumberPlateText(entity))
end
return entity
end